//按钮
const btn = [{
    name: '详情',
    value: 'check'
}, {
    name: '新增',
    value: 'create'
}, {
    name: '编辑',
    value: 'edit'
}, {
    name: '配置',
    value: 'config'
}, {
    name: '发布',
    value: 'publish'
}, {
    name: '推送',
    value: 'push'
}, {
    name: '删除',
    value: 'delete'
}, {
    name: '启动',
    value: 'start'
}, {
    name: '停用',
    value: 'pause'
}]


//卡券种类
const typeOption = [{
    value: '加息券',
    name: 'RAISE_RATES'
}, {
    value: '体验金',
    name: 'EXPERIENCE_MONEY'
}, {
    value: '兑换卡',
    name: 'EXCHANGE_COUPON'
}, {
    value: '贴息券',
    name: 'VOUCHER_COUPON'
}];

const typeOptionObj = {
    'RAISE_RATES': '加息券',
    'EXPERIENCE_MONEY': '体验金',
    'EXCHANGE_COUPON': '兑换卡',
    'VOUCHER_COUPON': '贴息券',
}


//卡券状态
const statusOption = [{
    value: '禁用',
    name: 'DISABLE'
}, {
    value: '启用',
    name: 'ENABLE'
}]
const statusOptionObj = {
    'DISABLE': '禁用',
    'ENABLE': '启用',
}

//卡券管理使用状态
const couponRecordstatusOption = [{
    value: '未使用',
    name: 'TO_USE'
}, {
    value: '已使用',
    name: 'USED'
}, {
    value: '已过期',
    name: 'EXPIRED'
}]

//派发用户选项
const userTypeArr = [{
    value: '1',
    name: '全部用户'
}, {
    value: '2',
    name: '已绑卡用户'
}, {
    value: '3',
    name: '指定用户'
}]

//卡券领取方式
const limitTypeArr = [{
    value: 'NO_LIMIT',
    name: '无限制'
}, {
    value: 'TOTAL_LIMIT',
    name: '账号领取限制'
}, {
    value: 'DAY_LIMIT',
    name: '每日领取限制'
}, {
    value: 'ORDER_LIMIT',
    name: '订单领取限制'
}]
const limitTypeObj = {
    'NO_LIMIT': '无限制',
    'TOTAL_LIMIT': '账号领取限制',
    'DAY_LIMIT': '每日领取限制',
    'ORDER_LIMIT': '订单领取限制',
}

//过期类型
const expireTypeArr = [{
    value: '固定日期过期',
    name: 'FIXED_DATE'
}, {
    value: '指定天数过期',
    name: 'ACTIVE_DAYS'
}]
const expireTypeObj = {
    'FIXED_DATE': '固定日期过期',
    'ACTIVE_DAYS': '指定天数过期',
}


//表单验证 https://github.com/yiminghe/async-validator
const formRules = {
    name: [
        { required: true, message: '请输入名称', trigger: 'blur' },
        { max: 30, message: '请填写最多30个字符' },
    ],
    faceValueInt: [
        //贴息券 兑换卡 的面值不能输入小数
        { required: true, type: 'number', message: '请输入面值', trigger: 'blur' },
        { type: 'integer', message: '请填写整数' },
        { min: 0, type: 'number', message: '不能小于0！' },
        { max: 99999, type: 'number', message: '请填写最多5位数字' },
    ],
    faceValue: [
        { required: true, type: 'number', message: '请输入面值', trigger: 'blur' },
        { min: 0, type: 'number', message: '不能小于0！' },
        { max: 99999, type: 'number', message: '请填写最多5位数字' },
    ],
    conditionNum: [
        { required: true, type: 'number', message: '请输入金额', trigger: 'blur' },
        { min: 0, type: 'number', message: '不能小于0！' },
        { max: 99999, type: 'number', message: '请填写最多5位数字' },
    ],
    cardDays: [
        { required: true, type: 'number', message: '请输入加息天数', trigger: 'blur' },
        { type: 'integer', message: '请填写整数' },
        { min: 0, type: 'number', message: '不能小于0！' },
        { max: 9999999, type: 'number', message: '请填写最多7位数字' },
    ],
    issueCount: [
        { required: true, type: 'number', message: '请输入发放数量', trigger: 'blur' },
        { type: 'integer', message: '请填写整数' },
        { min: 1, type: 'number', message: '不能小于0！' },
        { max: 9999999, type: 'number', message: '请填写最多7位数字' },
    ],
    limitType: [
        { required: true, message: '请选择', trigger: 'change' },
    ],
    limitNum: [
        { required: true, type: 'number', message: '请输入限制领取数量', trigger: 'blur' },
    ],
    vScopedate: [
        { required: true, type: 'array', message: '选择时间范围', trigger: 'blur' },
    ],
    expireType: [
        { required: true, message: '请选择', trigger: 'change' },
    ],
    vExpireDate: [ //固定过期时间
        { required: true, type: 'date', message: '选择过期时间', trigger: 'blur' },

    ],
    expireDays: [ //指定过期天数
        { required: true, type: 'number', message: '请输入指定过期天数', trigger: 'blur' },
        { type: 'integer', message: '请填写整数' },
        { min: 0, type: 'number', message: '不能小于0！' },
        { max: 9999, type: 'number', message: '请填写最多4位数字' },

    ],
    vUseDate: [
        { required: true, type: 'array', message: '选择时间范围', trigger: 'blur' },
    ],
    remark: [
        { required: true, message: '请填写描述', trigger: 'blur' },
        { max: 200, message: '请最多填写200个字符' },
    ],
    upload: [
        { required: true, message: '请填写描述', trigger: 'blur' },
    ],
    cardNum: [ //发放页面验证
        { required: true, type: 'number', message: '请输入每人发放数量', trigger: 'blur' },
        { type: 'integer', message: '请填写整数' },
        { min: 1, type: 'number', message: '请输入每人发放数量' },
        { max: 999, type: 'number', message: '请填写最多3位数字' },
    ],
    userList: [
        { required: true, message: '请先导入/填写手机号码', trigger: 'blur' },
    ],
    userType: [
        { required: true, message: '请选择', trigger: 'blur' },
    ],
}

const recordFilterRules = {
    tempDay: [
        { required: true, type: 'array', message: '选择时间范围', trigger: 'blur' },
    ],
}

const pickerDateRangeEndTime = { //领取结束时间不能晚于2037年，不然数据库报错
    disabledDate(date) {
        const time = date.getTime()
        return time > 2145801600000
    }
}

export {
    typeOption,
    typeOptionObj,
    statusOption,
    statusOptionObj,
    formRules,
    recordFilterRules,
    couponRecordstatusOption,
    limitTypeArr,
    limitTypeObj,
    expireTypeArr,
    expireTypeObj,
    userTypeArr,
    pickerDateRangeEndTime,
}